<?php

/**
 * Formulario base utilizado para realizar el registro de un cliente nuevo.
 *
 * @package    AltargetEcommerce
 * @subpackage form
 * @author     Carlo Lopez <carlo.xavier.lopez@gmail.com>
 */
class RegistroForm extends sfFormSymfony
{

  public function setup()
  {
    $this->setWidgets(array(
      'first_name'       => new sfWidgetFormInputText(),
      'last_name'        => new sfWidgetFormInputText(),
      'username'         => new sfWidgetFormInputText(),
      'email_address'    => new sfWidgetFormInputText(),
      'password'         => new sfWidgetFormInputText(),
      'password_confirm' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'first_name'       => new sfValidatorString(array('max_length' => 16)),
      'last_name'        => new sfValidatorString(array('max_length' => 16)),
      'username'         => new sfValidatorString(array('max_length' => 16)),
      'email_address'    => new sfValidatorEmail(),
      'password'         => new sfValidatorString(array('max_length' => 16)),
      'password_confirm' => new sfValidatorString(array('max_length' => 16)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again')
    );
  }

}
